Embodiments of the present invention relate to multiprocessing systems and, more specifically, to an adaptive runtime for a multiprocessing application program interface (API).
Various multiprocessing APIs, such as open multiprocessing (OpenMP), exist for programming parallel machines, in which memory is shared across multiple processors. Generally, processing in parallel machines allows for a master thread to recruit worker threads to perform work in parallel, thus more efficiently completing a program's workload.
For the use of a multiprocessing API, a compiler transforms a user program into executable code. A runtime environment supports the compiler and, when the program runs, performs overhead operations to enable some work of the program to be performed in parallel. For example, the runtime environment can maintain a list of available worker threads, assign work items to the threads, and synchronize the threads as needed.
A model for a multiprocessing API may include compiler directives, library routines, and environment variables, which can be implemented in a runtime environment in various ways. The behavior of the runtime environment is dependent on this implementation. Thus, a program may run more efficiently with one runtime environment versus another.